-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow the use of build.name
for naming provisioners and post-processors
#11432
Conversation
83f0536
to
73e3a29
Compare
* Add basic post-processor test Closes #11411
73e3a29
to
cc56959
Compare
ectx := cfg.EvalContext(BuildContext, nil) | ||
ectx.Variables[buildAccessor] = cty.ObjectVal(map[string]cty.Value{ | ||
"name": cty.StringVal(b.Name), | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could have also passed the extra variables as argument here, like:
ectx := cfg.EvalContext(BuildContext, nil) | |
ectx.Variables[buildAccessor] = cty.ObjectVal(map[string]cty.Value{ | |
"name": cty.StringVal(b.Name), | |
}) | |
variables := map[string]cty.Value{ | |
buildAccessor: cty.ObjectVal(map[string]cty.Value{ | |
"name": cty.StringVal(b.Name), | |
}), | |
} | |
ectx := cfg.EvalContext(BuildContext, variables) |
It looks bigger, just another possibility. Don't feel pressured to accept the changes. Yours looks great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, good catch !
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
This changes makes the builder variable
build.name
avialable at parsing so that it can be used to name provisioners and post-processors.Closes #11411